-
-
Couldn't load subscription status.
- Fork 33.2k
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot #104148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot #104148
Conversation
|
FYI, I plan on adding a test for this. [done] |
|
Any objections to this PR? It's blocking the per-interpreter GIL PR, so I'd like to merge it as soon as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from docs missing, this looks good to me.
|
I'm going to circle back to the docs after feature freeze. |
* main: pythongh-99113: Add PyInterpreterConfig.own_gil (pythongh-104204) pythongh-104146: Remove unused var 'parser_body_declarations' from clinic.py (python#104214) pythongh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (pythongh-104205) pythongh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (pythongh-104148) pythongh-99113: Share the GIL via PyInterpreterState.ceval.gil (pythongh-104203) pythonGH-100479: Add `pathlib.PurePath.with_segments()` (pythonGH-103975) pythongh-69152: Add _proxy_response_headers attribute to HTTPConnection (python#26152) pythongh-103533: Use PEP 669 APIs for cprofile (pythonGH-103534) pythonGH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (pythonGH-96849)
…pythongh-104148) I'll be adding a value to indicate support for per-interpreter GIL in pythongh-99114.
… Py_LIMITED_API (pythongh-111707) This should have been done in pythongh-104148. (A similar fix has already be done for that slot's value macros, and backported to 3.12. See pythongh-110968.) (cherry picked from commit 836e0a7) Co-authored-by: Eric Snow <[email protected]>
… Py_LIMITED_API (pythongh-111707) This should have been done in pythongh-104148. (A similar fix has already be done for that slot's value macros, and backported to 3.12. See pythongh-110968.)
… Py_LIMITED_API (pythongh-111707) This should have been done in pythongh-104148. (A similar fix has already be done for that slot's value macros, and backported to 3.12. See pythongh-110968.)
This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with pythongh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
… Py_LIMITED_API (pythongh-111707) This should have been done in pythongh-104148. (A similar fix has already be done for that slot's value macros, and backported to 3.12. See pythongh-110968.)
I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.